package com.bytech.common.biz.enums.emoticon;

import java.util.HashMap;
import java.util.Map;
import java.util.Optional;

import com.bytech.common.biz.enums.ServiceTypeEnum;
import com.bytech.common.biz.enums.comment.CommentTypeEnum;
import com.bytech.common.utils.StringUtils;
import lombok.Getter;

/**
 * @Author Zhao
 * @Create 2021/12/4 18:16
 */
@Getter
public enum EmoticonSourceEnum {

    DEFAULT("default", "默认"),
    AC_FUN("ac_fun", "AC娘"),
    AC_COLOR("ac_color", "AC彩娘"),
    AC_DOG("ac_dog", "AC犬娘"),
    ;

    private final String code;
    private final String desc;

    EmoticonSourceEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    private static Map<String, EmoticonSourceEnum> map = new HashMap<>(EmoticonSourceEnum.values().length);

    static {
        for (EmoticonSourceEnum e : EmoticonSourceEnum.values()) {
            map.put(e.code, e);
        }
    }

    public static EmoticonSourceEnum of(String code) {
        return Optional.ofNullable(map.get(code)).orElse(DEFAULT);
    }
}
